#ifndef PROTOCOLFRAMEGRABBER_H
#define PROTOCOLFRAMEGRABBER_H
#include <LogicPublicTypes.h>

class HD44780Analyzer;

class ProtocolFrameGrabber
{
public:
    ProtocolFrameGrabber() {}
    virtual ~ProtocolFrameGrabber() {}
    virtual void GrabFrame();
    void Init( HD44780Analyzer* Analyzer );

protected:
    virtual U64 GetData1();
    virtual U64 GetData2();
    virtual U8  GetFlag();
    virtual U8  GetFrameType( U64 FrameData );

protected:
    HD44780Analyzer* mAnalyzer;
};

class ProtocolFrameGrabber8Bits : public ProtocolFrameGrabber
{
public:
    ProtocolFrameGrabber8Bits() {}
    virtual ~ProtocolFrameGrabber8Bits() {}
    virtual U8  GetFrameType( U64 FrameData );

protected:
    virtual U64 GetData1();
};


class ProtocolFrameGrabber7Bits : public ProtocolFrameGrabber
{
public:
    ProtocolFrameGrabber7Bits() {}
    virtual ~ProtocolFrameGrabber7Bits() {}
    virtual void GrabFrame();

protected:
    virtual U64 GetData1();
    virtual U64 GetData2();
    virtual U8  GetFlag();

private:
    inline bool CommandsFromFirstNibbleIsDifferentThanCommandFromSecondNibble( U64 NibbleFromFirstFrame, U64 NibbleFromSecondFrame );
    inline U64 MergeNibblesBetweenTwoConsecutive4BitDataCapturePoints( U64 FirstNibble, U64 SecondNibble );
};



#endif